﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NH08.aspx.cs" Inherits="Xiaov.SmartWeb.Application.SZBBTree.NH08.NH08" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../../binary/dynaload.js" type="text/javascript"></script>
    <link href="../../Resources/easyui-1.32/themes/default/easyui.css" rel="stylesheet"
        type="text/css" />
    <link href="../../Resources/easyui-1.32/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../Resources/easyui-1.32/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../../Resources/easyui-1.32/jquery.easyui.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function OnReady(id) {
        ReloadGrid();
        }
        function ReloadGrid()                {
            var tableName = '<%=bbbm %>';
            var dwbm = $('#ddlDW').val();
            var nf = $('#ddlNF').val();
            var yf = $('#ddlYF').val();
            form1.AF.func("Build", "InitTable.aspx?tableName=" + tableName + "&dwbm=" + dwbm + "&nf=" + nf + "&yf=" + yf);
            //            form1.AF.func("Build", "nh08.xml");
            }
        function ClearReport()
        {
            var tn = '<%=bbbm %>';
            var dwbm = $('#ddlDW').val();
            var year = $('#ddlNF').val();
            var month = $('#ddlYF').val();
            $.ajax({
                type: 'post',
                url: '/PluginSrc/StatisticalSystem/ClearReport.aspx',
                data: { tn: tn,year:year,month:month,dwbm:dwbm },
                datatype: 'text',
                success: function (result) { ReloadGrid();alert('数据已清空'); },
                error: function (result) { alert(result.responseText); },
            });  
        }
        function save() {
            var dwbm = $('#ddlDW').val();
            var nf = $('#ddlNF').val();
            var yf = $('#ddlYF').val();
            var tableName = '<%=bbbm %>';
            var dwbm = $('#ddlDW').val();
            var xml = encodeURIComponent(form1.AF.func('GetUploadXML', ''));
            //                        alert(form1.AF.func('GetUploadXML', ''));
            $.ajax({
                type: "post",
                url: "SaveTable.aspx",
                dataType: "json",
                data: { nf: nf, tableName: tableName, yf: yf, xml: xml, dwbm: dwbm },
                success: function (data) {
                    var jsonData = data;
                    if (jsonData.save == 1) {
                        alert("保存成功");
                    }
                    else {
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert(errorThrown);
                }
            });
        }

        function Compute()
        {
            var tn = '<%=bbbm %>';
            var dwbm = $('#ddlDW').val();
            var year = $('#ddlNF').val();
            var month = $('#ddlYF').val();
            $.ajax({
                type: 'post',
                url: '/PluginSrc/StatisticalSystem/Compute.aspx',
                data: { tn: tn,year:year,month:month,dwbm:dwbm },
                datatype: 'text',
                success: function (result) { ReloadGrid();alert('计算完成');  },
                error: function (result) { alert(result.responseText); },
            });  
        }       

        function Sum()
        {
            var tn = '<%=bbbm %>';
            var dwbm = $('#ddlDW').val();
            var year = $('#ddlNF').val();
            var month = $('#ddlYF').val();
            $.ajax({
                type: 'post',
                url: '/PluginSrc/StatisticalSystem/Sum.aspx',
                data: { tn: tn,year:year,month:month,dwbm:dwbm },
                datatype: 'text',
                success: function (result) { ReloadGrid();alert('汇总完成'); },
                error: function (result) { alert(result.responseText); },
            });  
        }

    
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div style="height: 26px; font-size: 12px;">
        单位：<asp:DropDownList ID="ddlDW" runat="server" AutoPostBack="true">
        </asp:DropDownList>
        时间：
        <asp:DropDownList ID="ddlNF" runat="server" AutoPostBack="true">
        </asp:DropDownList>
        <asp:DropDownList ID="ddlYF" runat="server" AutoPostBack="true">
        </asp:DropDownList>
    </div>
    <div id="p" class="easyui-panel" title="<%=modelXml.Title %>" style="width: auto;
        height: 70px; padding: 10px;">
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',disabled:true">
            新增子节点</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-remove',disabled:true">
                删除行</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'"
                    onclick="save()">保存</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'"
                        onclick="ClearReport()">清空</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'"
                            onclick="Compute()">计算</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload',disabled:true">
                                表间提取</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-sum',disabled:<%=sum %>"
                                    onclick="Sum()">分级汇总</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-redo',disabled:true">
                                        继承</a>
    </div>
    <div style="position: relative; width: 96%; height: 530px">
        <script type="text/javascript">            insertReport('AF', 'Rebar=Print,Font;WorkMode=UploadRunTime;isHiLightTabOrder=false')</script>
    </div>
    </form>
</body>
</html>
